<?php
require_once (APPLICATION_DIR."/application/model/Faqgroup.php");

class Faqgroup extends DataObjects_Faqgroup 
{
    function getAllFaqGroupInfo()
    {
        $this->selectAdd();
        $this->selectAdd("*");
        $this->orderBy("group_order");
        $this->find();
        return $this;
    }
    
    function getAllShowFaqGroup()
    {
        $this->selectAdd();
        $this->selectAdd("*");
        $this->whereAdd();
        $this->whereAdd("group_hide = 0");
        $this->orderBy("group_order");
        $this->find();
        return $this;
    }
    
    function toogleHide($group_id,$hide)
	{
	    $this->group_id = $group_id;
	    $this->group_hide = 1 - $hide;
	    $this->update();
	}
	
	function getFaqGroupInfoByID($group_id)
	{
	    $this->group_id = $group_id;
	    $this->find();
	    return $this;
	}
	
	function updateGroup($args)
	{
	    $this->group_id      = $args['group_id'];
	    $this->group_name  = $args['group_name'];
	    $this->group_order = $args['group_order'];
	    $this->update();
	}
	
	function addgroup($args)
	{
	    $this->group_name  = $args['group_name'];
	    $this->group_order = $args['group_order'];
	    $this->insert();
	}
	
	function deletegroup($group_id)
	{
	    $this->group_id = $group_id;
	    $this->delete();
	}
}

?>
